<template>
    <div class="page">
        <div class="title">
            <el-icon size="36px" @click="back">
                <ArrowLeft />
            </el-icon>
            <h1>日志</h1>
        </div>

        <el-table :data="data" :border="true">
            <el-table-column prop="id" label="Id"></el-table-column>
            <el-table-column prop="msg" label="信息"></el-table-column>
            <el-table-column prop="type" label="类型"></el-table-column>
            <el-table-column prop="time" label="时间"></el-table-column>
        </el-table>
    </div>
</template>
<script setup>
import axios from "axios";
import { ArrowLeft } from "@element-plus/icons-vue";
import { useRouter } from "vue-router";

const router = useRouter();

const data = ref([]);
const back = () => {
    router.go(-1)
}
const getData = () => {
    axios.get("http://127.0.0.1:3000/log").then((res) => {
        console.log("res", res);
        if (res.data.code == 200) {
            data.value = res.data.data;
        }
    });
};
getData();
</script>
<style lang="scss" scoped>
.page {
    width: 100vw;
    min-height: 100vh;
    box-sizing: border-box;
    padding: 12px;

    display: flex;
    flex-flow: column nowrap;
    justify-content: flex-start;
    align-items: center;

    .title {
        width: 100%;
        height: 50px;
        line-height: 50px;
        text-align: left;

        display: flex;
        flex-flow: row nowrap;
        justify-content: flex-start;
        align-items: center;
        margin-bottom: 12px;
    }
}
</style>
